<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <script>
        a = 100;
        function demo(e) {
            function e(){}
            arguments[0] = 2;
            console.log(e);  //2
            if(a) {
                var b = 123;
                function c() {//function不能定义在if里，但是以前可以

                }
            }
            // var c;
            a = 10;
            var a;
            console.log(b);  //undefined
            f = 123;
            console.log(c);  //undefined,函数没有提升成功,现在和变量声明类似，赋值undefined
            console.log(a); //10
        }
        var a;
        demo(1);
        console.log(a); //100
        console.log(f); //123
    </script> -->
    
    <!-- <script type="text/javascript">

        var str = false + 1;
        document.write(str);//1
        var demo = false == 1;
        document.write(demo);//false
        if (typeof (a) && -true + (+undefined) + "") {
            // 'undefined'    -1        NaN

            document.write('基础扎实');
        }
        if (11 + "11" * 2 == 33) {
            document.write('基础扎实');
        }
        !!" " + !!"" - !!false || document.write('射雕英雄传');
        //  !! 优先级比乘除还高

    </script> -->


    <script>
        // var a = (window.foo || (window.foo = 'bar'));
        // console.log(foo);//输出 字符串'bar'
        // 并不会先算括号里面的，括号优先级最高，先看成一个整体，然后从左往右计算
        //不只是括号，乘除也一样，先看成一个整体

        // var a = (window.foo && (window.foo = 'bar'));
        // console.log(foo);

        // window.foo = 'bar' 会创建属性foo，然后赋值
        // 访问window.foo，返回undefined，但是并没有创建属性foo


        var a = ((window.foo = 'bar') && window.foo);
        console.log(a);
    </script>
</body>

</html>